﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link href="~/Content/AUI/css/aui.css" rel="stylesheet" />
    <link href="~/Content/AUI/css/aui-flex.css" rel="stylesheet" />
    <link href="~/Content/AUI/css/Calendar.css" rel="stylesheet" />
</head>
<body>
    <div class="aui-center">
        <header class="aui-bar aui-bar-nav aui-bar-light">
            <a tapmode onclick="javascript: history.go(-1)" class="aui-pull-left"><span class="aui-iconfont aui-icon-left"></span></a>
            <span style="margin-left:-50px">已预约的体检</span>
        </header>
    </div>
    <div class="aui-content">
        <ul class="aui-list-view">
            @{
                foreach (var item in ViewBag.Alreadybooked)
                {
                    <li class="aui-list-view-cell">
                        <h3>美亚体检</h3>
                        <p>体检人：<span id="Name">@item.Name</span></p>
                        <p>体检机构：<span id="OrgName">@item.OrgName</span></p>
                        <p>预约时间：<span id="bookDate">@item.bookDate</span></p>
                        <p>预约编号：<span id="orderNo">@item.orderNo</span></p>
                        <p>体检地址：<span id="OrgAddress">@item.OrgAddress </span></p>
                        <input type="hidden" id="bookDept" value="@item.bookDept" />
                        <hr class="aui-border-b" />
                        <h4>体检须知</h4>
                        <p style="color:aquamarine">1.空腹</p>
                        <p style="color:aquamarine">2.啦啦啦啦啦啦啦啦啦啦啦啦</p>
                        <p style="color:aquamarine">3.噜噜噜噜噜噜噜噜噜噜噜噜噜噜噜噜噜噜噜</p>
                    </li>
                }
            }
        </ul>
    </div>
    <div class="aui-center">
        <div class="aui-dialog-footer">
            <div class="aui-btn aui-btn-primary aui-btn-block" onclick="CancelOrder()">取消预约</div>
        </div>
    </div>
</body>
</html>
<script src="~/Content/AUI/script/api.js"></script>
<script src="~/Content/AUI/script/aui-tap.js"></script>
<script src="~/Content/AUI/script/aui-dialog.js"></script>
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script>
    function CancelOrder() {
        var dialog = new auiDialog({});
        dialog.alert({
            title: "温馨提示",
            msg: '确认取消已预约的体检？',
            buttons: ['取消', '确定']
        }, function (ret) {
            if (ret.buttonIndex == 1) {
                return false;//history.back();
            }
            else {
                if (ret.buttonIndex == 2) {
                    CancelOrderDo();
                }
            }
        });
    }
    //取消预约
    function CancelOrderDo() {
        $.ajax({
            type: "post",
            url: "/store/CancelOrder",
            data: { OrderNo: $("#orderNo").text(), BookDept: $("#bookDept").val(), BookDate: $("#bookDate").text() },
            success: function (result) {
                if (result) {
                    alert("预约取消成功！");
                    location.href = '../Home/Index';
                } else {
                    alert("预约取消失败！");
                    history.back();
                }
            }
        });
    }
</script>